package com.fuhao.rabbit.direct;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.util.SerializationUtils;

import java.util.Map;

/**
 * @author zhang
 * @title: Comsumer2
 * @projectName spring-rabbit
 * @description: TODO
 * @date 2019/5/1921:41
 */
public class Comsumer2 implements MessageListener {
    @Override
    public void onMessage(Message message) {
        Map<String,String> map = (Map<String, String>) SerializationUtils.deserialize(message.getBody());
        String name = map.get("name");
        System.out.println("接收到消息："+name);
    }
}
